-- closure example
create_step_gen = function(start, step)
    local i = start
    return function()
        i = i + step
        return i
    end
end

gen = create_step_gen(0, 2)
gen2 = create_step_gen(0, 2)
print(gen())
print(gen())
print(gen())
print(gen2())
